package com.example.demo.common.util;

import com.example.demo.common.domain.Employee;
import org.apache.catalina.User;

import java.util.Vector;

public class Singleton {
    private static Singleton singleton;
    private Vector<String> employesNames;


    private Singleton() {
        this.employesNames=new Vector<String>();
    }

    //在内存中只存在一个Singleton类
   public boolean judge(String eName){
        for(String e: employesNames){
            if(e.equals(eName)){
                return false;
            }
        }
        employesNames.add(eName);
        return true;
   }

    public static Singleton getSingleton() {
        if(singleton==null) {
            singleton=new Singleton();
        }
        return singleton;
    }

}
